<div class="app-content-body ">    
    <div class="bg-light lter b-b wrapper-md hidden-print">
      <h1 class="m-n font-thin h3">会员实名认证</h1>
    </div>
    <div class="vip-info dx-viewport demo-container">
    	<form class="my-form" id="form-container"  action="" method="">
	    	<div class="row form_row">
	    		<div id="vipcert" class="col-xs-12 col-sm-10 col-md-8 col-lg-6"></div>
	    	</div>          
    		<div class="row form_row">
    			<div class="padding">
					<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 text-right">
	    				<div id="save" class="vipcert_save"></div>
	    			</div>
    			</div>
    		</div>
    	</form>
    </div>
</div>
<script>

$(function() {
    var form = $("#vipcert").dxForm({
        readOnly: false,
        validationGroup: "customerData",
        items:[{
            itemType: "group",
            items: [{
                dataField: "nickname",
                editorOptions: {readOnly: true},
                label: {text: '会员昵称'}
            }, {
                dataField: "mobile",
                editorOptions: {readOnly: true},
                label: {text: '会员手机号'}
            }, {
                dataField: "uname",
                label: {text: '会员姓名'},
                validationRules: [{
                    type: "required",
                    message: "请输入会员姓名"
                }]
            },{
                dataField: "identity_card",
                label: {text: '身份证号'},
                validationRules: [{
                    type: "required",
                    message: "请输入身份证号"
                }]
            }]
        }]
    }).dxForm("instance");

    $("#content").one("route.loaded", function(e, context) {
      var store = $.crudStore(API("members")), id = context.params.id;

      store.byKey(id).then(function (resp) {
          form.updateData(resp);
      });

      $("#form-container").on("submit", function(e) {
        store.update(id, form.option('formData')).then(function (resp) {
            DevExpress.ui.notify({
                message: "已完成"
            }, "success", 1000);

            context.redirect('#/members');
        })
        
        return false;
      });

    });

    $("#save").dxButton({
        text: "保存",
        type: "success",
        useSubmitBehavior: true,
        validationGroup: "customerData"
    });

});
</script>